#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <hash_set>
using namespace std;
using namespace stdext;

const int puzzle_side = 3;
const int puzzle_count = puzzle_side * puzzle_side;

struct Offset
{
	int r;
	int c;
	char op;
}offsets[4] = { {-1, 0, 'u'}, {0, 1, 'r'}, {1, 0, 'd'}, {0, -1, 'l'} };

struct Puzzle
{
	unsigned int pos;
	int posx;
	int distance;
	char ops[64];
	int opc;

	Puzzle()
	{
		pos = 0;
		posx = 0;
		distance = 128; //max
		opc = 0;
	}

	void FromStr( const char* desc )
	{
		for(int i = 0; i < puzzle_count; i++)
		{
			while( *desc == ' ' ) desc++;
			char c = *(desc++);
			if( c >= '1' && c <= '8' )
			{
				int j = 4 * ( c - '1' );
				pos &= ~( 0xf << j );
				pos |= ( ( ( ( i / puzzle_side ) << 2 ) + i % puzzle_side ) << j );
			}
			else if( c == 'x' )
			{
				posx = ( ( i / puzzle_side ) << 2 ) + i % 3;
			}
		}
	}

	inline bool Move( int d, Puzzle& p ) const
	{
		int r = (posx >> 2) + offsets[d].r;
		int c = (posx & 0x3) + offsets[d].c;
		if( r < 0 || r >= puzzle_side ) return false;
		if( c < 0 || c >= puzzle_side ) return false;
		p.posx = (r << 2) + c;
		p.pos = pos;
		for(int i = 0; i < puzzle_count - 1; i++)
		{
			if( ( ( pos >> ( i << 2 ) ) & 0xf ) == p.posx )
			{
				p.pos &= ~( 0xf << ( i << 2 ) );
				p.pos |= ( posx << ( i << 2 ) );
				break;
			}
		}
		for(int i = 0; i < opc; i++) p.ops[i] = ops[i];
		p.opc = opc;
		p.ops[p.opc++] = offsets[d].op;
		return true;
	}

	inline bool Equal( const Puzzle& p )
	{
		return pos == p.pos;
	}

	bool operator< ( const Puzzle& p ) const
	{
		return distance > p.distance;
	}

	void Trace()
	{
		for( int i = 0; i < opc; i++ )
		{
			cout << ops[i];
		}
		cout << endl;
	}

	inline void Distance( const Puzzle& p )
	{
		int target = p.pos;
		distance = 0;
		for(int i = 0; i < (puzzle_count - 1) * 2; i++)
		{
			int dr = ( ( pos >> ( i << 1 ) ) & 0x3 ) - ( ( target >> ( i << 1 ) ) & 0x3 );
			distance += ( dr < 0 ? -dr : dr );
		}
	}


};

bool solvable( const char* desc )
{
	char p[puzzle_count] = {0};
	for(int i = 0; i < puzzle_count - 1; i++)
	{
		while( *desc < '1' || *desc > '8' ) desc++;
		p[i] = *desc;
		desc++;
	}

	int sum = 0;
	for(int j = 0; j < puzzle_count - 1; j++)
	{
		for(int k = j + 1; k < puzzle_count - 1; k++)
		{
			if( p[j] < p[k] ) sum++;
		}
	}
	return sum % 2 == 0;
}

void slove( const Puzzle& start, const Puzzle& end )
{
	priority_queue<Puzzle> ss;
	hash_set<unsigned int> hs;

	ss.push( start );
	hs.insert( start.pos );

	while( !ss.empty() )
	{
		Puzzle op = ss.top();
		ss.pop();

		Puzzle np;
		for(int i = 0; i < 4; i++)
		{
			if( !op.Move( i, np ) ) continue;
			if( np.Equal( end ) )
			{
				np.Trace();
				return;
			}

			hash_set<unsigned int>::const_iterator it = hs.find( np.pos );
			if( it == hs.end() )
			{
				np.Distance( end );
				ss.push( np );
				hs.insert( np.pos );
			}
		}
	}

	//cout << unsolvable" << endl;
	return;
}

int main()
{
	Puzzle end;
	end.FromStr( "12345678x" );

	string desc;
	while( getline( cin, desc ) )
	{
		if( !solvable( desc.c_str() ) )
		{
			cout << "unsolvable" << endl;
		}
		else
		{
			Puzzle start;
			start.FromStr( desc.c_str() );
			slove( start, end );
		}
		break;
	}
	return 0;
}
